
<?php
	require_once("connect_sql.php");
	
	$author = $_GET['author'];
	$board = $_GET['board'];
	$customer = $_GET['customer'];
	$business = $_GET['business'];
	$platform = $_GET['platform'];
	$function = $_GET['function'];
	$lcd = $_GET['lcd'];
	$camera = $_GET['camera'];
	$rfpa = $_GET['rfpa'];
	$classK = $_GET['classK'];
	$lastVersion = $_GET['lastVersion'];
	$lastDate = $_GET['lastDate'];
	//$gbVersion = $_GET['gbVersion'];
	$ataVersion = $_GET['ataVersion'];
	$id = $_GET['id'];

	//TODO add other data
	$sql = "update project set author=$author, board=\"$board\", customer=$customer, business=\"$business\", 
		platform=$platform, function=\"$function\", lcd=\"$lcd\", camera=\"$camera\", rfpa=$rfpa, classK=$classK, 
		lastVersion=\"$lastVersion\", lastDate=\"$lastDate\", ataVersion=\"$ataVersion\" where id=$id";
	if(!mysql_query($sql)) {
		echo "";
	} else {
		echo "successed";
		
		$str = '老项目(';
		if($ret = mysql_query('select name from author where id='.$author)) {
			$ret = mysql_fetch_array($ret);
			$str .= $ret['name'].', ';
		}
		$str .= $board.', ';
		if($ret = mysql_query('select name from customer where id='.$customer)) {
			$ret = mysql_fetch_array($ret);
			$str .= $ret['name'].', ';
		}
		$str .= $business.', ';
		$str .= $lastVersion;
		$str .= ')';
		
		mysql_query('insert into log (user, nickname, action, date, content, sqlStr) values("'.$_COOKIE['username'].'", "'.$_COOKIE['nickname'].'", "更新", "'.date("Y-m-d").'", \''.$str.'\', \''.$sql.'\')');
	}

?>